import request from '@/utils/request'

// 查询货物信息列表
export function listGood(query) {
  return request({
    url: '/goods/good/list',
    method: 'get',
    params: query
  })
}

// 查询货物信息详细
export function getGood(goodsId) {
  return request({
    url: '/goods/good/' + goodsId,
    method: 'get'
  })
}

// 新增货物信息
export function addGood(data) {
  return request({
    url: '/goods/good',
    method: 'post',
    data: data
  })
}

// 修改货物信息
export function updateGood(data) {
  return request({
    url: '/goods/good',
    method: 'put',
    data: data
  })
}

// 删除货物信息
export function delGood(goodsId) {
  return request({
    url: '/goods/good/' + goodsId,
    method: 'delete'
  })
}

// 查询货物信息详细
export function getGoodByWayBillNumber(waybillNumber) {
  return request({
    url: '/goods/good/waybill/' + waybillNumber,
    method: 'get'
  })
}

// 新增货物信息
export function addGoodAndCalculate(data) {
  return request({
    url: '/goods/good/waybill',
    method: 'post',
    data: data
  })
}

// 修改货物信息
export function updateGoodAndCalculate(data) {
  return request({
    url: '/goods/good/waybill',
    method: 'put',
    data: data
  })
}

// 修改货物运单编号
export function updateWayBillNumberAndCalculate(goodsId, waybillNumber) {
  return request({
    url: '/goods/good/waybill/' + goodsId + '/' + waybillNumber,
    method: 'put',
    //params: data
  })
}

// 移除货物信息
export function removeGoodAndCalculate(goodsId, waybillNumber) {
  return request({
    url: '/goods/good/waybill/' + goodsId + '/' + waybillNumber,
    method: 'delete'
  })
}

// 修改货物入库编号
export function updateGoodEnterWarehouseNumber(goodsId, enterWarehouseNumber, data) {
  return request({
    url: '/goods/good/enternumber/' + goodsId + '/' + enterWarehouseNumber,
    method: 'put',
    params: data
  })
}

// 移除货物入库单编号
export function removeGoodEnterWarehouseNumber(goodsId, enterWarehouseNumber) {
  return request({
    url: '/goods/good/enternumber/' + goodsId + '/' + enterWarehouseNumber,
    method: 'delete'
  })
}

// 修改货物入库查验状态
export function updateGoodEnterWarehouseCheck(goodsId, checkStatus) {
  return request({
    url: '/goods/good/entercheck/' + goodsId + '/' + checkStatus,
    method: 'put',
    //params: data
  })
}

// 查询货物信息详细，按入库单号
export function getGoodByEnterNumber(enterNumber) {
  return request({
    url: '/goods/good/enterprint/' + enterNumber,
    method: 'get'
  })
}

// 修改货物出库编号
export function updateGoodExitWarehouseNumber(goodsIds, exitWarehouseNumber, data) {
  return request({
    url: '/goods/good/exitnumber/' + goodsIds + '/' + exitWarehouseNumber,
    method: 'put',
    data: data
  })
}

// 移除货物出库编号
export function removeGoodExitWarehouseNumber(goodsId, exitWarehouseNumber) {
  return request({
    url: '/goods/good/exitnumber/' + goodsId + '/' + exitWarehouseNumber,
    method: 'delete'
  })
}

// 修改货物出库查验状态
export function updateGoodExitWarehouseCheck(goodsId, checkStatus) {
  return request({
    url: '/goods/good/exitcheck/' + goodsId + '/' + checkStatus,
    method: 'put',
    //params: data
  })
}

// 查询货物信息详细，按出库单号
export function getGoodByExitNumber(exitNumber) {
  return request({
    url: '/goods/good/exitprint/' + exitNumber,
    method: 'get'
  })
}

// 查询货物信息详细，按货转ID
export function listGoodTransferExt(goodsTransferId, query) {
  return request({
    url: '/goods/good/transfer/' + goodsTransferId,
    method: 'get',
    params: query
  })
}

// 查询货物信息详细，按货转单ID，货转单打印使用
export function getGoodByGoodsTransferId(goodsTransferId) {
  return request({
    url: '/goods/good/transferprint/' + goodsTransferId,
    method: 'get'
  })
}

// 物理删除货物信息
export function delGoodExt(goodsId) {
  return request({
    url: '/goods/good/ext/' + goodsId,
    method: 'delete'
  })
}

// 新增货物信息
export function batchAddGood(data) {
  return request({
    url: '/goods/good/batchadd',
    method: 'post',
    data: data
  })
}

// 查询货物总量
export function getGoodsWeightSum(query) {
  return request({
    url: '/goods/good/goodsweightsum',
    method: 'get',
    params: query
  })
}

// 查询货物信息详细，按日出库统计ID，日出库统计，关联货物显示，使用
export function listGoodByDayExitStatisticId(dayExitStatisticId, query) {
  return request({
    url: '/goods/good/dayexitstatistic/' + dayExitStatisticId,
    method: 'get',
    params: query
  })
}

// 查询货物信息详细，按月出库统计ID，月出库统计，关联货物显示，使用
export function listGoodByMonthExitStatisticId(monthExitStatisticId, query) {
  return request({
    url: '/goods/good/monthexitstatistic/' + monthExitStatisticId,
    method: 'get',
    params: query
  })
}

// 货物拆分接口
export function splitGood(numberOfSplit, splitWeight, data) {
  return request({
    url: '/goods/good/split/' + numberOfSplit + '/' + splitWeight,
    method: 'post',
    data: data
  })
}

// 查询货物信息列表，模糊搜索，捆包号
export function listGoodExt(query) {
  return request({
    url: '/goods/good/listext',
    method: 'get',
    params: query
  })
}

// 查询货物信息列表，模糊搜索，多捆包号
export function listGoodFuzzy(query) {
  return request({
    url: '/goods/good/listfuzzy',
    method: 'get',
    params: query
  })
}

// 查询货物信息详细，按盘库ID，关联货物显示，使用
export function listGoodByCheckGoodsId(checkGoodsId, query) {
  return request({
    url: '/goods/good/inventory/' + checkGoodsId,
    method: 'get',
    params: query
  })
}
